tools/hotplug: fix conditions in systemd service files for dom0
authorOlaf Hering <olaf@aepfle.de>
Fri, 24 Oct 2014 14:17:04 +0000 (16:17 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 27 Oct 2014 10:13:17 +0000 (10:13 +0000)
ConditionVirtualization= checks if systemd runs in some sort of guest.
It is not supposed to detect host capabilities. The current
implementation happens to work because systemd-detect-virt from v208
returns also 'xen' in a dom0. In v210 and later 'none' is returned and
no service files will be started.

Adjust the checks to detect a dom0 vs. native boot. Mounting xenfs
depends on /proc/xen, but should only be done for pvops because xenfs
exists only there. All other service files should not be started in
domU. The file /proc/xen/capabilities exists in both dom0 and domU in a
pvops kernel, but only in dom0 it contains 'control_d'. The existing
ExecStartPre= check will prevent starting in a domU.

ConditionVirtualization=!xen is true in a dom0. But this check is broken
in systemd v208, so its not used.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/hotplug/Linux/systemd/proc-xen.mount.in
tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
tools/hotplug/Linux/systemd/xen-watchdog.service.in
tools/hotplug/Linux/systemd/xenconsoled.service.in
tools/hotplug/Linux/systemd/xendomains.service.in
tools/hotplug/Linux/systemd/xenstored.service.in
tools/hotplug/Linux/systemd/xenstored.socket.in
tools/hotplug/Linux/systemd/xenstored_ro.socket.in

index f0c4f3a556ce5b6c08063b20bde664e5db5782c3..64ebe7f9b120d95d9ed4a4a6253d5e024b4e4164 100644 (file)
@@ -1,6 +1,7 @@
 [Unit]
 Description=Mount /proc/xen files
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen
+ConditionPathExists=!/proc/xen/capabilities
 RefuseManualStop=true
 
 [Mount]
index 44dfce8fc45eba1a26d3be06d5a2a01c83901afc..6c46be3daac51e226e831cd7c2e344671a5a63b6 100644 (file)
@@ -1,6 +1,8 @@
 [Unit]
 Description=mount xenstore file system
-ConditionVirtualization=xen
+Requires=proc-xen.mount
+After=proc-xen.mount
+ConditionPathExists=/proc/xen/capabilities
 RefuseManualStop=true
 
 [Mount]
index d3470fcaa212f403da426a91457319de2e51c867..52101af56abd79d457cc17e4b1bc127911460b50 100644 (file)
@@ -4,7 +4,7 @@ Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
 After=xenstored.service xenconsoled.service
 Before=xendomains.service libvirtd.service libvirt-guests.service
 RefuseManualStop=true
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
 
 [Service]
 Type=simple
index ee77bf97ae02327849ef105c038431dfa3f86e97..1eecd2a616250131186ac1904fdcd452404e608e 100644 (file)
@@ -2,7 +2,7 @@
 Description=Xen-watchdog - run xen watchdog daemon
 Requires=proc-xen.mount
 After=proc-xen.mount xendomains.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
 
 [Service]
 Type=forking
index 7ca026469040f8914769bd465c576bc237fd96d5..6ab0fc1a2f47595805092f6a858ab5ea7990f699 100644 (file)
@@ -2,7 +2,7 @@
 Description=Xenconsoled - handles logging from guest consoles and hypervisor
 Requires=xenstored.socket
 After=xenstored.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
 
 [Service]
 Type=simple
index f88c3366602e725b5ee22c1b7578f7e4369b0666..2684df06056cb1d96742264de3c9da5b77f5ce6b 100644 (file)
@@ -2,7 +2,7 @@
 Description=Xendomains - start and stop guests on boot and shutdown
 Requires=xenstored.socket
 After=xenstored.service xenconsoled.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
 
 [Service]
 Type=oneshot
index 013e69e7926b936dd5b43b143fe0cbff2451bcc0..0f0d77dab5396d059b8d100a52a2b2094758e27e 100644 (file)
@@ -4,7 +4,7 @@ Requires=xenstored_ro.socket xenstored.socket proc-xen.mount var-lib-xenstored.m
 After=proc-xen.mount var-lib-xenstored.mount
 Before=libvirtd.service libvirt-guests.service
 RefuseManualStop=true
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
 
 [Service]
 Type=notify
index 461e4f47868717810eeef09d7818488cf3d53cc2..9b28e7481a738f441f09ac58df5fdf7a3caf7771 100644 (file)
@@ -1,6 +1,6 @@
 [Unit]
 Description=xenstore socket
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
 
 [Socket]
 ListenStream=/var/run/xenstored/socket
index 6ab5c28f296fb1865e73c5d87080810f8814cb9f..80402b39efa3023008d7710fe8dfef8ed6ddf07d 100644 (file)
@@ -1,6 +1,6 @@
 [Unit]
 Description=xenstore ro socket
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
 
 [Socket]
 ListenStream=/var/run/xenstored/socket_ro